//
//  MLABaseModel.m
//  MagicLampApp
//
//  Created by Zheng on 2018/12/25.
//  Copyright © 2018 zheng.magic.lamp.app. All rights reserved.
//

#import "MLABaseModel.h"
#import <Foundation/Foundation.h>

@implementation MLABaseModel

+ (NSDictionary *)mj_replacedKeyFromPropertyName {
    return @{@"modelId":@"id",
             @"operatorStr":@"operator"};
}

- (NSString *)money {
    CGFloat moneyNum = _money.integerValue/100.f;
    return [NSString stringWithFormat:@"%.2f",moneyNum];
}

- (NSString *)price {
    CGFloat moneyNum = _price.integerValue/100.f;
    return [NSString stringWithFormat:@"%.2f",moneyNum];
}


- (NSString *)ctime {
    return [self getTimeFormatStr:_ctime];
}

- (NSString *)getTimeFormatStr:(NSString *)ctime {
    NSDate *date = [NSDate dateWithTimeIntervalSince1970:_ctime.integerValue];
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"yyyy-MM-dd  hh:mm"];
    NSString *dateStr = [formatter stringFromDate: date];
    return dateStr;
}

@end
